import request from '@/utils/request'

enum API{
    DISHESINFOLIST = '/dishes/dishesInfoListPage/',
    DISHESINFOBYNAME = '/dishes/dishesInfoListPage/',
    DISHESDELETE = '/dishes/deleteDish',
    BATCHDELETEDISHESINFO = '/dishes/batchDeleteDishesInfo?dishesInfoArr=',
    DISHESADDORUPDATE = '/dishes/addOrUpdateDish'
}
export const reqDishesInfoList = (currentPage: number, limit: number) => request.get(API.DISHESINFOLIST + `${currentPage}/${limit}`)

export const reqDishesByTitle = (
    currentPage: number,
    limit: number,
    dishesName: String,
) => request.get(API.DISHESINFOBYNAME + `${currentPage}/${limit}/${dishesName}`)

export const reqDeleteDishes = (dishesInfoId: any) => {
    // 通过URL路径或查询参数传递id
    return request.delete(`/dishes/deleteDish/`+dishesInfoId);
};

export const reqBatchDeleteDishesInfo = (ids:any)=>
    request.delete<any,any>(API.BATCHDELETEDISHESINFO + `${ids}`)

export const addOrUpdateDishesInfo=(DishseParams:any)=>
    request.post<any,any>(API.DISHESADDORUPDATE,DishseParams)